package com.gumanx;

import cpw.mods.fml.common.network.Player;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;

public class ItemStaffExplosion extends Item {

	public ItemStaffExplosion(int par1) {
		super(par1);
		this.setCreativeTab(CreativeTabs.tabCombat);
	}

	public boolean hasEffect(ItemStack par1ItemStack) {
		return true;
	}

	public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
			EntityPlayer par3EntityPlayer) {
		MovingObjectPosition Coord = par3EntityPlayer.rayTrace(300, 1);
		if (Coord != null) {
			par2World.spawnEntityInWorld(new EntityBombThrowable(par2World,
					Coord.blockX, Coord.blockY, Coord.blockZ));
			par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.resistance.id,10));
		}
		return par1ItemStack;
	}

	public void registerIcons(IconRegister iconReg) {
		itemIcon = iconReg.registerIcon("gumanx:staffExplosion");
	}

}